package kr.hkit.androidcomplete03.ch21;

import kr.hkit.androidcomplete03.R;
import kr.hkit.androidcomplete03.ch20.FragmentTest;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class Ch21Main extends ListActivity {
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
				this, R.array.ch21, android.R.layout.simple_list_item_1);
		setListAdapter(adapter);
	}

	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent = null;
		switch (position) {
		case 0:
			intent = new Intent(this, ActionBarTest.class);
			break;
		case 1:
			intent = new Intent(this, ActionView.class);
			break;
		case 2:
			intent = new Intent(this, ActionSwitch.class);
			break;
		case 3:
			intent = new Intent(this, ShareAction.class);
			break;
		case 4:
			intent = new Intent(this, DisplayOption.class);
			break;
		}
		startActivity(intent);
	}
}
